from django.db import models

# Create your models here.


class Bepartment(models.Model):
    """部门"""
    name = models.CharField(max_length=30, verbose_name='部门名')
    create_date = models.DateField(verbose_name='创建时间')

    class Meta:
        db_table = 'tb_bepartment'
        verbose_name = '部门'
        verbose_name_plural = verbose_name

    def __str__(self):
        return '%s' % self.name


class User(models.Model):
    """用户"""
    name = models.CharField(max_length=30, verbose_name='姓名')
    age = models.IntegerField()
    bepartment = models.ForeignKey('test1.Bepartment', on_delete=models.DO_NOTHING, related_name='用户', verbose_name='部门')

    class Meta:
        db_table = 'to_user'
        verbose_name = '用户'
        verbose_name_plural = verbose_name

    def __str__(self):
        return '%s' % self.name